package com.lovo.proxy;

import java.lang.reflect.Proxy;

public class AdminMain {
    public static void main(String[] args) {
        // 静态代理
//        IAdminControl adminControl = new AdminControlProxy(new AdminControlImpl());

        // 动态代理
//        IAdminControl adminControl = (IAdminControl) Proxy.newProxyInstance(AdminControlImpl.class.getClassLoader()
//                ,AdminControlImpl.class.getInterfaces()
//                ,new AdminControlInvocation(new AdminControlImpl()));

        // cglib代理
        AdminControlImpl adminControl = (AdminControlImpl) new AdminControlInterceptor(new AdminControlImpl()).getProxyInstance();
        adminControl.find();
        adminControl.update();
        adminControl.add();
    }
}
